
--解析城市坐标
mapBaseCfg = require "mapBaseCfg"



local arr = {}

for i,v in ipairs(mapBaseCfg) do
	if i % 2 == 1 then
		table.insert(arr , v)
	end
end

-- 方案1

local newArr = {}
local newSum = 0

local i = 1
local count = 0
local tType = -1
while(i <= #arr ) do

	local v = arr[i]
	if count == 0  then
		local row = {}
		tType = -1
		table.insert(newArr , row)
	end
	if tType ~= v then
		table.insert(newArr[#newArr],count * 100 + v)
		tType = v
	end


	count = 1 + count

	if count >= 500 then
		count = 0
	end

	i = i + 1

end



local str = "local mapAreaBaseCfg = {"
for i,v in ipairs(newArr) do
	str = str.."{"
	for j,t in ipairs(v) do
		str = str ..t
		if j ~= #v then
			str = str..","
		end

	end
	str = str .."}"
	if i ~= #newArr then
		str = str..","
	end
end
str = str .. "}"
str = str .. "return mapAreaBaseCfg"
print (str)
-- print (#str)




-- -- 1. (1, 2) #=>
-- local p = {x =1,y = 3}
-- -- 2. 0  * 500  + 3   25061
-- local oldPosIndex = ((p.x - 1) * 500) + p.y
-- print ("oldPosIndex" , oldPosIndex)
-- print ("arr" ,arr[oldPosIndex])
-- -- 3. math.floor(25061)/ 8 =  3132
-- local newPosIndex = math.floor(oldPosIndex / 8)
-- print ("newPosIndex" , newPosIndex)
-- -- 4. 3394 * 8 = 25056
-- local tmpPosIndex = newPosIndex * 8
-- print("tmpPosIndex",tmpPosIndex)
-- -- 5. offset  #=>  25061 - 25056   = 5
-- local offset = oldPosIndex - tmpPosIndex
-- print("offset",offset)
-- -- 6. mapbae[3132] = 168041025641
-- local newData = newArr[newPosIndex + 1]
-- print (newData)

-- 7. math.floor(840205126564 / math.pow(40, 4) % 40= subNum
--print( math.floor(newData/ math.pow(40, (offset - 1))) % 40)


